<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<style>
		body {
			background: url(https://i0.hdslb.com/bfs/article/5c7ee6323f57eaecdf796b00af4d2331e5abbe5a.jpg);
			background-size: cover;
			text-align: center;
		}
		textarea {
			border-radius: 5px;
			font-size: 15px;
			background-color: rgba(255, 255, 255, 0.2);
			color: red;
			border: 1px solid blue;
			height: var(--high);
			width: var(--wide);
		}
		textarea:focus {
			background-color: rgba(255, 255, 255, 0.5);
		}
		</style>
		<title>⑨的笔记本</title>
	</head>
	<body>
		<script>
			document.body.style.setProperty('--wide', document.body.clientWidth + 'px');
			document.body.style.setProperty('--high', window.innerHeight / 3 + 'px');
			var cur = 0;
			function ins(val) {
				var text = "";
				switch(val) {
					case "ans1":
						text = `<p>输入填空答案</p>
						<input type="text" id="text">
						<button onclick="document.getElementById('question').value += \`<input type=&quot;text&quot; id=&quot;\${cur}&quot; data-answer=&quot;\${document.getElementById('text').value}&quot;>\`; cur++;">插入</button>`;
						break;
					case "ans2":
						cur++;
						break;
				}
				document.getElementById('insert').innerHTML = text;
			}
		</script>
		<h1>添加错题</h1>
		<form action="add.php" method="post">
			<p>输入题目：</p>
			<textarea id="question"></textarea>
			<p>插入
			<select onchange="ins(this.value)">
				<option>请选择</option>
				<option value="ans1">填空</option>
				<option value="ans2">解答</option>
			</select>
			：</p>
			<div id="insert"></div>
		</form>
	</body>
</html>
